﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace Damany.Cameras
{
   

    public partial class CyNetNativeConstants
    {

        /// CAMERA_INFO_LEN -> 1024
        public const int CAMERA_INFO_LEN = 1024;

        /// ID -> 0x00
        public const int ID = 0;

        /// WIDTH -> 0x01
        public const int WIDTH = 1;

        /// HEIGHT -> 0x02
        public const int HEIGHT = 2;

        /// BITS -> 0x03
        public const int BITS = 3;

        /// COLOR -> 0x04
        public const int COLOR = 4;

        /// SP_CHECK -> 0x06
        public const int SP_CHECK = 6;

        /// C_SOFT_VERSION -> 0x07
        public const int C_SOFT_VERSION = 7;

        /// C_PRODUCT_NO -> 0x0B
        public const int C_PRODUCT_NO = 11;

        /// HEART_BEAT -> 0x0F
        public const int HEART_BEAT = 15;

        /// SOFT_VERSION -> 0x12
        public const int SOFT_VERSION = 18;

        /// DEVICE_NO -> 0x13
        public const int DEVICE_NO = 19;

        /// PRODUCT_NO -> 0x14
        public const int PRODUCT_NO = 20;

        /// C_DEVICE_NO -> 0x15
        public const int C_DEVICE_NO = 21;

        /// C_SP_PRODUCT_INFO -> 0x19
        public const int C_SP_PRODUCT_INFO = 25;

        /// USB_RL -> 0x1D
        public const int USB_RL = 29;

        /// USB_SPECIAL -> 0x1E
        public const int USB_SPECIAL = 30;

        /// IF_USB_FORMAT -> 0x1
        public const int IF_USB_FORMAT = 1;

        /// IF_USB_CHECK -> 0x2
        public const int IF_USB_CHECK = 2;

        /// IF_USB_AUTO_FORMAT -> 0x3
        public const int IF_USB_AUTO_FORMAT = 3;

        /// IF_USB_FLAG_FORMATED -> 0x4
        public const int IF_USB_FLAG_FORMATED = 4;

        /// IF_USB_DISABLE -> 0x5
        public const int IF_USB_DISABLE = 5;

        /// MCU_VERSION -> 0x1F
        public const int MCU_VERSION = 31;

        /// GAIN_UNIT -> 0x20
        public const int GAIN_UNIT = 32;

        /// OFFSET_UNIT -> 0x21
        public const int OFFSET_UNIT = 33;

        /// FREQ_UNIT -> 0x22
        public const int FREQ_UNIT = 34;

        /// TIME_UNIT -> 0x23
        public const int TIME_UNIT = 35;

        /// MAX_GAIN -> 0x30
        public const int MAX_GAIN = 48;

        /// MIN_GAIN -> 0x31
        public const int MIN_GAIN = 49;

        /// MAX_OFFSET -> 0x32
        public const int MAX_OFFSET = 50;

        /// MIN_OFFSET -> 0x33
        public const int MIN_OFFSET = 51;

        /// MAX_FREQ -> 0x34
        public const int MAX_FREQ = 52;

        /// MIN_FREQ -> 0x35
        public const int MIN_FREQ = 53;

        /// MAX_TIME -> 0x36
        public const int MAX_TIME = 54;

        /// MIN_TIME -> 0x37
        public const int MIN_TIME = 55;

        /// MAX_BALANCEMODE -> 0x38
        public const int MAX_BALANCEMODE = 56;

        /// MAX_AGCLIMIT -> 0x39
        public const int MAX_AGCLIMIT = 57;

        /// MAX_AGCSELECT -> 0x3a
        public const int MAX_AGCSELECT = 58;

        /// MIX_TOTAL_GAIN -> 0x3b
        public const int MIX_TOTAL_GAIN = 59;

        /// MAX_TOTAL_GAIN -> 0x3c
        public const int MAX_TOTAL_GAIN = 60;

        /// C_AFE_INFO -> 0x60
        public const int C_AFE_INFO = 96;

        /// PROTECT_AREA -> 0x8f
        public const int PROTECT_AREA = 143;

        /// GAIN -> 0x90
        public const int GAIN = 144;

        /// OFFSET -> 0x91
        public const int OFFSET = 145;

        /// FREQ -> 0x92
        public const int FREQ = 146;

        /// TIME -> 0x93
        public const int TIME = 147;

        /// SYNC -> 0x94
        public const int SYNC = 148;

        /// AGCMODE -> 0xb0
        public const int AGCMODE = 176;

        /// AGCLIMIT -> 0xb1
        public const int AGCLIMIT = 177;

        /// AGCSELECT -> 0xb2
        public const int AGCSELECT = 178;

        /// AGCTIME -> 0xb3
        public const int AGCTIME = 179;

        /// AGC_GAIN_MAX -> 0xb4
        public const int AGC_GAIN_MAX = 180;

        /// AGC_TIME_MIN -> 0xb5
        public const int AGC_TIME_MIN = 181;

        /// AGC_TIME_MAX -> 0xb6
        public const int AGC_TIME_MAX = 182;

        /// AREA_X -> 0xb7
        public const int AREA_X = 183;

        /// AREA_Y -> 0xb8
        public const int AREA_Y = 184;

        /// AREA_W -> 0xb9
        public const int AREA_W = 185;

        /// AREA_H -> 0xba
        public const int AREA_H = 186;

        /// AREA_EN -> 0xbb
        public const int AREA_EN = 187;

        /// DIGITAL_GAIN_R -> 0xbc
        public const int DIGITAL_GAIN_R = 188;

        /// DIGITAL_GAIN_G -> 0xbd
        public const int DIGITAL_GAIN_G = 189;

        /// DIGITAL_GAIN_B -> 0xbe
        public const int DIGITAL_GAIN_B = 190;

        /// GAIN_R -> 0xc9
        public const int GAIN_R = 201;

        /// GAIN_G -> 0xca
        public const int GAIN_G = 202;

        /// GAIN_B -> 0xcb
        public const int GAIN_B = 203;

        /// BALANCEMODE -> 0xd2
        public const int BALANCEMODE = 210;

        /// PRE_SET_GAIN_R -> 0xd3
        public const int PRE_SET_GAIN_R = 211;

        /// PRE_SET_GAIN_G -> 0xd4
        public const int PRE_SET_GAIN_G = 212;

        /// PRE_SET_GAIN_B -> 0xd5
        public const int PRE_SET_GAIN_B = 213;

        /// AUTOGRAY -> 0xe0
        public const int AUTOGRAY = 224;

        /// GRID -> 0xe1
        public const int GRID = 225;

        /// GRID_1B1 -> 0
        public const int GRID_1B1 = 0;

        /// GRID_1B2 -> 1
        public const int GRID_1B2 = 1;

        /// GRID_1B4 -> 2
        public const int GRID_1B4 = 2;

        /// BIN -> 0xe2
        public const int BIN = 226;

        /// GAMMA_EN -> 0xe3
        public const int GAMMA_EN = 227;

        /// IMAGE_FORMAT -> 0xe4
        public const int IMAGE_FORMAT = 228;

        /// IF_JPEG -> 0
        public const int IF_JPEG = 0;

        /// IF_H264 -> 1
        public const int IF_H264 = 1;

        /// TRIG_IMAGE_FORMAT -> 0xe5
        public const int TRIG_IMAGE_FORMAT = 229;

        /// IMAGE_ZOOM_W -> 0xe6
        public const int IMAGE_ZOOM_W = 230;

        /// IMAGE_ZOOM_H -> 0xe7
        public const int IMAGE_ZOOM_H = 231;

        /// COM_IO_DIRECT -> 0xE8
        public const int COM_IO_DIRECT = 232;

        /// COM_IO_INTERRUPT -> 0xE9
        public const int COM_IO_INTERRUPT = 233;

        /// COM_IO_LEVEL -> 0xEa
        public const int COM_IO_LEVEL = 234;

        /// COM_IO_ACK -> 0xEB
        public const int COM_IO_ACK = 235;

        /// COM_LED -> 0xEC
        public const int COM_LED = 236;

        /// COM_RESET -> 0xED
        public const int COM_RESET = 237;

        /// MPEG_RATE -> 0xec
        public const int MPEG_RATE = 236;

        /// MPEG_INIT -> 0xed
        public const int MPEG_INIT = 237;

        /// CHARACTER_X -> 0xee
        public const int CHARACTER_X = 238;

        /// CHARACTER_Y -> 0xef
        public const int CHARACTER_Y = 239;

        /// SOFT_TRIGGER -> 0xf0
        public const int SOFT_TRIGGER = 240;

        /// TEST_IMAGE -> 0xf1
        public const int TEST_IMAGE = 241;

        /// TIME_STAMP -> 0xf2
        public const int TIME_STAMP = 242;

        /// CMD_AD9949 -> 0xf3
        public const int CMD_AD9949 = 243;

        /// NOISE_FLT -> 0xf4
        public const int NOISE_FLT = 244;

        /// EDGE_ENAHNCER -> 0xf5
        public const int EDGE_ENAHNCER = 245;

        /// DRC -> 0xf6
        public const int DRC = 246;

        /// SERVER_IP -> 0x100
        public const int SERVER_IP = 256;

        /// SERVER_PORT -> 0x101
        public const int SERVER_PORT = 257;

        /// TRI_JPEG_Q -> 0x102
        public const int TRI_JPEG_Q = 258;

        /// TRI_EXP_TIME -> 0x103
        public const int TRI_EXP_TIME = 259;

        /// TRI_GAIN -> 0x104
        public const int TRI_GAIN = 260;

        /// TRI_GAIN_R -> 0x105
        public const int TRI_GAIN_R = 261;

        /// TRI_GAIN_G -> 0x106
        public const int TRI_GAIN_G = 262;

        /// TRI_GAIN_B -> 0x107
        public const int TRI_GAIN_B = 263;

        /// TRI_GAMA_EN -> 0x108
        public const int TRI_GAMA_EN = 264;

        /// EXT_SYNC_EN -> 0x109
        public const int EXT_SYNC_EN = 265;

        /// EXT_SYNC_DELAY -> 0x110
        public const int EXT_SYNC_DELAY = 272;

        /// EXT_TRIG_DELAY -> 0x111
        public const int EXT_TRIG_DELAY = 273;

        /// FLASH_MODE -> 0x112
        public const int FLASH_MODE = 274;

        /// IOTRIG_MODE -> 0x113
        public const int IOTRIG_MODE = 275;

        /// IOTRIG_MODE_SPEED -> 0
        public const int IOTRIG_MODE_SPEED = 0;

        /// IOTRIG_MODE_SIGNAL -> 1
        public const int IOTRIG_MODE_SIGNAL = 1;

        /// TRI_PARAM_EN -> 0x11F
        public const int TRI_PARAM_EN = 287;

        /// TRI_PARAM_TIME_EN -> (1<<0)
        public const int TRI_PARAM_TIME_EN = (1) << (0);

        /// TRI_PARAM_GAIN_EN -> (1<<1)
        public const int TRI_PARAM_GAIN_EN = (1) << (1);

        /// TRI_PARAM_RGB_GAIN_EN -> (1<<2)
        public const int TRI_PARAM_RGB_GAIN_EN = (1) << (2);

        /// IP_ADDR -> 0x120
        public const int IP_ADDR = 288;

        /// GATEWAY -> 0x121
        public const int GATEWAY = 289;

        /// NETMASK -> 0x122
        public const int NETMASK = 290;

        /// CTRL_PORT -> 0x123
        public const int CTRL_PORT = 291;

        /// TRAN_PORT -> 0x124
        public const int TRAN_PORT = 292;

        /// TF_COUNT -> 0x125
        public const int TF_COUNT = 293;

        /// JPEG_SET -> 0x126
        public const int JPEG_SET = 294;

        /// EXP_OUT_EN -> 0x127
        public const int EXP_OUT_EN = 295;

        /// TRIG_SET -> 0x128
        public const int TRIG_SET = 296;

        /// XC_SET -> 0x129
        public const int XC_SET = 297;

        /// RADAR_SET_0 -> 0x12B
        public const int RADAR_SET_0 = 299;

        /// RADAR_SET_1 -> 0x12C
        public const int RADAR_SET_1 = 300;

        /// RADAR_SET_2 -> 0x12D
        public const int RADAR_SET_2 = 301;

        /// RADAR_SET_3 -> 0x12E
        public const int RADAR_SET_3 = 302;

        /// RADAR_SET_4 -> 0x12F
        public const int RADAR_SET_4 = 303;

        /// YEAR -> 0x130
        public const int YEAR = 304;

        /// MONTH -> 0x131
        public const int MONTH = 305;

        /// DAY -> 0x132
        public const int DAY = 306;

        /// HOUR -> 0x133
        public const int HOUR = 307;

        /// MINUTE -> 0x134
        public const int MINUTE = 308;

        /// SECOND -> 0x135
        public const int SECOND = 309;

        /// TRIGGER_DELAY -> 0x136
        public const int TRIGGER_DELAY = 310;

        /// EXP_DELAY -> 0x137
        public const int EXP_DELAY = 311;

        /// SELECT_IMAGE -> 0x13F
        public const int SELECT_IMAGE = 319;

        /// USER_INFO -> 0x140
        public const int USER_INFO = 320;

        /// SOFT_RESET -> 0xFF0002
        public const int SOFT_RESET = 16711682;

        /// SYNC_PARAM -> 0xFF0003
        public const int SYNC_PARAM = 16711683;

        /// SAVE_PARAM -> 0xFF0004
        public const int SAVE_PARAM = 16711684;

        /// RESET_PARAM -> 0xFF0005
        public const int RESET_PARAM = 16711685;

        /// CMD_GAMMA -> 0xFF0006
        public const int CMD_GAMMA = 16711686;

        /// CMD_HDJZ -> 0xFF0007
        public const int CMD_HDJZ = 16711687;

        /// SET_SNH -> 0xFFAA00
        public const int SET_SNH = 16755200;

        /// SET_SNL -> 0xFFAA01
        public const int SET_SNL = 16755201;

        /// SET_ZiH -> 0xFFAA02
        public const int SET_ZiH = 16755202;

        /// SET_ZiL -> 0xFFAA03
        public const int SET_ZiL = 16755203;

        /// SET_MKH -> 0xFFAA04
        public const int SET_MKH = 16755204;

        /// SET_MKL -> 0xFFAA05
        public const int SET_MKL = 16755205;

        /// SET_CKH -> 0xFFAA06
        public const int SET_CKH = 16755206;

        /// SET_CKL -> 0xFFAA07
        public const int SET_CKL = 16755207;

        /// CODE_RESET -> 0xFFAA08
        public const int CODE_RESET = 16755208;

        /// CODE_LOCK -> 0xFFAA09
        public const int CODE_LOCK = 16755209;

        /// CODE_SET -> 0xFFAA0A
        public const int CODE_SET = 16755210;

        /// SET_DATA -> 0xFFAA0B
        public const int SET_DATA = 16755211;

        /// RET_ERR -> 0
        public const int RET_ERR = 0;

        /// RET_OK -> 1
        public const int RET_OK = 1;
    }

    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]
    public struct CyNetFRAME_HEADER
    {

        /// unsigned short
        public ushort w;

        /// unsigned short
        public ushort h;

        /// unsigned short
        public ushort bits;

        /// unsigned short
        public ushort format;

        /// unsigned short
        public ushort frame_type;

        /// unsigned short
        public ushort frame_rev;

        /// unsigned int
        public uint firmware_version;

        /// unsigned int
        public uint device_no;

        /// unsigned int
        public uint len;

        /// unsigned int
        public uint speed;

        /// unsigned int
        public uint rs232;

        /// unsigned short
        public ushort year;

        /// unsigned short
        public ushort month;

        /// unsigned short
        public ushort day;

        /// unsigned short
        public ushort hour;

        /// unsigned short
        public ushort minute;

        /// unsigned short
        public ushort second;

        /// unsigned int
        public uint ip;

        /// unsigned int
        public uint frame_count;

        /// unsigned int
        public uint trigger_count;

        /// unsigned int
        public uint trigger_index;

        /// unsigned int
        public uint frame_no;

        /// unsigned int
        public uint gain;

        /// unsigned int
        public uint time;

        /// unsigned int
        public uint gain_r;

        /// unsigned int
        public uint gain_g;

        /// unsigned int
        public uint gain_b;

        /// unsigned int
        public uint mode;

        /// unsigned int
        public uint JpegQ;

        /// unsigned int
        public uint td1;

        /// unsigned int
        public uint td2;

        /// unsigned int
        public uint trig_chl;

        /// unsigned int
        public uint msecond;

        /// unsigned int
        public uint yavg;

        /// unsigned int
        public uint mpeg_head;

        /// unsigned int
        public uint freq;

        /// unsigned int[7]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = System.Runtime.InteropServices.UnmanagedType.U4)]
        public uint[] rev;

        /// unsigned char[64]
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 64)]
        public string user_info;
    }

    public partial class CyNetNativeMethods
    {

        private const string DllName = "CYNET_API";

        /// Return Type: void
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_Open")]
        public static extern void CYNET_Open();


        /// Return Type: void
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_Close")]
        public static extern void CYNET_Close();


        /// Return Type: void
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_SendHeartBeatPackage")]
        public static extern void CYNET_SendHeartBeatPackage();


        /// Return Type: int
        ///ip: char*
        ///portc: USHORT->unsigned short
        ///ports: USHORT->unsigned short
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_AddCamera", CallingConvention = CallingConvention.Cdecl)]
        public static extern int CYNET_AddCamera(System.IntPtr ip, ushort portc, ushort ports);


        /// Return Type: int
        ///ip: char*
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_DelCamera", CallingConvention = CallingConvention.Cdecl)]
        public static extern int CYNET_DelCamera(System.IntPtr ip);


        /// Return Type: int
        ///ip: char*
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_SelectCamera", CallingConvention = CallingConvention.Cdecl)]
        public static extern int CYNET_SelectCamera(System.IntPtr ip);


        /// Return Type: BOOL->int
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_GetCameraState", CallingConvention = CallingConvention.Cdecl)]
        [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]
        public static extern bool CYNET_GetCameraState();


        /// Return Type: int
        ///bCapStart: BOOL->int
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_CapStart", CallingConvention = CallingConvention.Cdecl)]
        public static extern int CYNET_CapStart([System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] bool bCapStart);


        /// Return Type: int
        ///pData: char*
        ///pLen: int*
        ///ip: char*
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_GetFrame", CallingConvention = CallingConvention.Cdecl)]
        public static extern int CYNET_GetFrame(System.IntPtr pData, ref int pLen, System.IntPtr ip);


        /// Return Type: int
        ///bCtrlStart: BOOL->int
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_CtrlStart", CallingConvention = CallingConvention.Cdecl)]
        public static extern int CYNET_CtrlStart([System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] bool bCtrlStart);


        /// Return Type: ULONG->unsigned int
        ///nName: int
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_ReadCameraParam", CallingConvention = CallingConvention.Cdecl)]
        public static extern uint CYNET_ReadCameraParam(int nName);


        /// Return Type: int
        ///nCmd: int
        ///nBuf: char*
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_SendCommand", CallingConvention = CallingConvention.Cdecl)]
        public static extern int CYNET_SendCommand(int nCmd, System.IntPtr nBuf);


        /// Return Type: double
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_GetTimeUnit", CallingConvention = CallingConvention.Cdecl)]
        public static extern double CYNET_GetTimeUnit();


        /// Return Type: double
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_GetFrameUnit", CallingConvention = CallingConvention.Cdecl)]
        public static extern double CYNET_GetFrameUnit();


        /// Return Type: double
        ///nB: int*
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_GetGainUnit", CallingConvention = CallingConvention.Cdecl)]
        public static extern double CYNET_GetGainUnit(ref int nB);


        /// Return Type: int
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_GetOffsetUnit", CallingConvention = CallingConvention.Cdecl)]
        public static extern int CYNET_GetOffsetUnit();


        /// Return Type: void
        ///pRGB: BYTE*
        ///pBayer: BYTE*
        ///w: int
        ///h: int
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_BayerToRGB", CallingConvention = CallingConvention.Cdecl)]
        public static extern void CYNET_BayerToRGB(ref byte pRGB, ref byte pBayer, int w, int h);


        /// Return Type: void
        ///pRGB: USHORT*
        ///pBayer: USHORT*
        ///w: int
        ///h: int
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_BayerToRGB_12bit", CallingConvention = CallingConvention.Cdecl)]
        public static extern void CYNET_BayerToRGB_12bit(ref ushort pRGB, ref ushort pBayer, int w, int h);


        /// Return Type: void
        ///pRGB: BYTE*
        ///pBayer: BYTE*
        ///w: int
        ///h: int
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_BayerToRGB_HQI", CallingConvention = CallingConvention.Cdecl)]
        public static extern void CYNET_BayerToRGB_HQI(ref byte pRGB, ref byte pBayer, int w, int h);


        /// Return Type: void
        ///pRGB: USHORT*
        ///pBayer: USHORT*
        ///w: int
        ///h: int
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_BayerToRGB_HQI_12bit", CallingConvention = CallingConvention.Cdecl)]
        public static extern void CYNET_BayerToRGB_HQI_12bit(ref ushort pRGB, ref ushort pBayer, int w, int h);


        /// Return Type: boolean
        ///lpSrcBuffer: BYTE*
        ///dwSrcSize: DWORD->unsigned int
        ///lpDstBuffer: BYTE*
        ///dwDstSize: DWORD*
        ///lpdwWidth: DWORD*
        ///lpdwHeight: DWORD*
        ///lpBits: DWORD*
        ///dwReserve1: DWORD*
        [System.Runtime.InteropServices.DllImportAttribute(DllName, EntryPoint = "CYNET_JpegDecode", CallingConvention = CallingConvention.Cdecl)]
        [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.I1)]
        public static extern bool CYNET_JpegDecode(ref byte lpSrcBuffer, uint dwSrcSize, ref byte lpDstBuffer, ref uint dwDstSize, ref uint lpdwWidth, ref uint lpdwHeight, ref uint lpBits, ref uint dwReserve1);

    }

}
